package com.yonyou.ucf.mdf.app.isvdxq.firstpart.location.mapper;

import com.yonyou.ucf.mdf.app.isvdxq.firstpart.location.entity.OrderStoreEntity;
import org.apache.ibatis.jdbc.SQL;

public class OrderStoreSqlProvider {

    public String insertSelective(OrderStoreEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("dxq_orderstore");

        if (record.getId() != null) {
            sql.VALUES("`id`", "#{id,jdbcType=INTEGER}");
        }

        if (record.getDatatype() != null) {
            sql.VALUES("`datatype`", "#{datatype,jdbcType=INTEGER}");
        }

        if (record.getDatastatus() != null) {
            sql.VALUES("`datastatus`", "#{datastatus,jdbcType=INTEGER}");
        }

        if (record.getTranstype() != null) {
            sql.VALUES("`transtype`", "#{transtype,jdbcType=VARCHAR}");
        }

        if (record.getMainid() != null) {
            sql.VALUES("`mainid`", "#{mainid,jdbcType=VARCHAR}");
        }

        if (record.getCode() != null) {
            sql.VALUES("`code`", "#{code,jdbcType=VARCHAR}");
        }

        if (record.getStatus() != null) {
            sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
        }

        if (record.getType() != null) {
            sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
        }

        if (record.getStatus() != null) {
            sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
        }

        if (record.getShopid() != null) {
            sql.VALUES("`shopid`", "#{shopid,jdbcType=VARCHAR}");
        }
        if (record.getInventoryowner() != null) {
            sql.VALUES("`inventoryowner`", "#{inventoryowner,jdbcType=VARCHAR}");
        }
        if (record.getReceiveid() != null) {
            sql.VALUES("`receiveid`", "#{receiveid,jdbcType=VARCHAR}");
        }
        if (record.getTplid() != null) {
            sql.VALUES("`tplid`", "#{tplid,jdbcType=VARCHAR}");
        }

        if (record.getWarehouseid() != null) {
            sql.VALUES("`warehouseid`", "#{warehouseid,jdbcType=VARCHAR}");
        }

        if (record.getOperateuserid() != null) {
            sql.VALUES("`operateuserid`", "#{operateuserid,jdbcType=VARCHAR}");
        }

        if (record.getOperatetime() != null) {
            sql.VALUES("`operatetime`", "#{operatetime,jdbcType=VARCHAR}");
        }

        if (record.getOperatetype() != null) {
            sql.VALUES("`operatetype`", "#{operatetype,jdbcType=VARCHAR}");
        }

        if (record.getOperatetypename() != null) {
            sql.VALUES("`operatetypename`", "#{operatetypename,jdbcType=VARCHAR}");
        }

        if (record.getSourceid() != null) {
            sql.VALUES("`sourceid`", "#{sourceid,jdbcType=VARCHAR}");
        }

        if (record.getSourcecode() != null) {
            sql.VALUES("`sourcecode`", "#{sourcecode,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceid() != null) {
            sql.VALUES("`firstsourceid`", "#{firstsourceid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcecode() != null) {
            sql.VALUES("`firstsourcecode`", "#{firstsourcecode,jdbcType=VARCHAR}");
        }

        if (record.getDr() != null) {
            sql.VALUES("`dr`", "#{dr,jdbcType=SMALLINT}");
        }

        return sql.toString();
    }

    public String updateByPrimaryKeySelective(OrderStoreEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("dxq_orderstore");

        if (record.getDatatype() != null) {
            sql.SET("`datatype` = #{datatype,jdbcType=INTEGER}");
        }

        if (record.getDatastatus() != null) {
            sql.SET("`datastatus` = #{datastatus,jdbcType=INTEGER}");
        }

        if (record.getTranstype() != null) {
            sql.SET("`transtype` = #{transtype,jdbcType=VARCHAR}");
        }

        if (record.getMainid() != null) {
            sql.SET("`mainid` = #{mainid,jdbcType=VARCHAR}");
        }

        if (record.getCode() != null) {
            sql.SET("`code` = #{code,jdbcType=VARCHAR}");
        }

        if (record.getStatus() != null) {
            sql.SET("`status` = #{status,jdbcType=INTEGER}");
        }

        if (record.getType() != null) {
            sql.SET("`type` = #{type,jdbcType=INTEGER}");
        }

        if (record.getStatus() != null) {
            sql.SET("`status` = #{status,jdbcType=INTEGER}");
        }

        if (record.getShopid() != null) {
            sql.SET("`shopid` = #{shopid,jdbcType=VARCHAR}");
        }
        if (record.getInventoryowner() != null) {
            sql.SET("`inventoryowner` = #{inventoryowner,jdbcType=VARCHAR}");
        }
        if (record.getReceiveid() != null) {
            sql.SET("`receiveid` = #{receiveid,jdbcType=VARCHAR}");
        }
        if (record.getTplid() != null) {
            sql.SET("`tplid` = #{tplid,jdbcType=VARCHAR}");
        }

        if (record.getWarehouseid() != null) {
            sql.SET("`warehouseid` = #{warehouseid,jdbcType=VARCHAR}");
        }

        if (record.getOperateuserid() != null) {
            sql.SET("`operateuserid` = #{operateuserid,jdbcType=VARCHAR}");
        }

        if (record.getOperatetime() != null) {
            sql.SET("`operatetime` = #{operatetime,jdbcType=VARCHAR}");
        }

        if (record.getOperatetype() != null) {
            sql.SET("`operatetype` = #{operatetype,jdbcType=VARCHAR}");
        }

        if (record.getOperatetypename() != null) {
            sql.SET("`operatetypename` = #{operatetypename,jdbcType=VARCHAR}");
        }

        if (record.getSourceid() != null) {
            sql.SET("`sourceid` = #{sourceid,jdbcType=VARCHAR}");
        }

        if (record.getSourcecode() != null) {
            sql.SET("`sourcecode` = #{sourcecode,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceid() != null) {
            sql.SET("`firstsourceid` = #{firstsourceid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcecode() != null) {
            sql.SET("`firstsourcecode` = #{firstsourcecode,jdbcType=VARCHAR}");
        }

        if (record.getDr() != null) {
            sql.SET("`dr` = #{dr,jdbcType=SMALLINT}");
        }

        sql.WHERE("`id` = #{id,jdbcType=INTEGER}");

        return sql.toString();
    }
}